<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>男装专区</title>
    <link rel="stylesheet" type="text/css" href="<%=path %>/statics/css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/statics/css/loading.css"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/statics/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/statics/css/style.css"/>
    <script src="<%=path %>/statics/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
    	$(window).load(function(){
    		$(".loading").addClass("loader-chanage");
    		$(".loading").fadeOut(300);
    	});
    </script>
    <script type="text/javascript">
    	var num;
    	//删除进行时
		function deleteorder(){
		 	 $.ajax({
				type:"GET",
				url:"<%=path%>/OrderDetail/delOrder.json",
				data:{id:num},
				dataType:"json",
				success:function(data){
				
					if(data.delOrder=="true"){//删除成功：移除当前div,无提示，异步刷新
					var order = document.getElementById(num); 
					order.remove();
					}else if(data.delOrder == "false"){//删除失败
						alert("对不起，删除失败");
					}else{
						alert(111);
					}
				},
				error:function(data){  //异常
					alert("对不起，删除异常");
				}
			}); 
		}

//点击删除图标提示是否删除
function del(orderid){
	num=orderid;
	
	var flag=confirm("亲，您真的要取消订单吗？");
	if(flag){ //点击确定删除宝贝
		deleteorder();
	}
};
   </script>                          
</head>
<!--loading页开始-->
<div class="loading">
	<div class="loader">
        <div class="loader-inner pacman">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
	</div>
</div>
<!--loading页结束-->
<body>
	<header class="top-header fixed-header">
		<a class="icona" href="javascript:history.go(-1)">
				<img src="<%=path %>/statics/images/left.png"/>
			</a>
		<h3>全部订单</h3>
			<a class="iconb" href="<%=path %>/shopcar.html">
			</a>
	</header>
	
	<div class="contaniner fixed-conta">
	 <c:forEach items="${list }" var="OrderDetail">
		<section class="order" id="${OrderDetail.getId()}">
			<dl id="${OrderDetail.getId()}">
				<dt>
					<time>${OrderDetail.getOrder().getCreateTime() }</time>
					<c:if test="${OrderDetail.getFahuoid()==1 }">
						<span>已发货</span>
					</c:if>
					<c:if test="${OrderDetail.getFahuoid()==2 }">
						<span>待发货</span>
					</c:if>
					
				</dt>
				<ul>
					<a href="<%=path %>/product/detail/${OrderDetail.getProductId()}">
						<figure><img src="<%=path %>/statics/files/${OrderDetail.getProducts().getFileName()}"/></figure>
						<li>
							<p>${OrderDetail.getProducts().getDescription()}</p>
							<c:if test="${!empty OrderDetail.getColor() }">
								<small>颜色：${OrderDetail.getColor() }</small>
							</c:if>
							 <c:if test="${!empty OrderDetail.getSize() }">
							 	<span>尺寸：${OrderDetail.getSize() }</span>
							 </c:if>
							<b>${OrderDetail.getProducts().getPrice() }</b>
							<strong>数量：${OrderDetail.getQuantity() }</strong>
						</li>
					</a>
				</ul>
				<dd>
					<h3>商品总额</h3>
					<i>${OrderDetail.getCost() }</i>
				</dd>
				<dd>
				<c:if test="${ OrderDetail.getFahuoid()==1}">
					<input type="button" value="确认收货" class="order-que"/>
					<input type="button" value="查看物流" onclick="javascript:location.href='<%=path %>/OrderDetail/sys/wuli/${OrderDetail.getProductId()}'" />
					</c:if>
					
					<c:if test="${OrderDetail.getZhifu()==2}">
						<input type="button" value="取消订单" onclick="del(${OrderDetail.getId()})"/>
					</c:if>
					
					
					
					<c:if test="${OrderDetail.fahuoid==1} ">
						<input type="button" value="申请退款" class="order-que" />
					</c:if>
				
					<c:if test="${OrderDetail.getZhifu()==2 }">
					<input type="button" onclick="location.href='<%=path%>/product/sys/buyid.html?oid=${OrderDetail.id }'" value="去付款" class="order-que"/>
					</c:if>	
				</dd>
			</dl>
		
			
		</section>
		</c:forEach>	
	</div>
</body>
</html>